package Tier2;

import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

import Shared._Config;

/**
 * Implémente le protocole RMI. 
 * Lance le service PartyManager, spécifié dans Tier2/RMI_PartyManager/PartyManager.java, 
 * implémenté par Tier2/PartyManagerImpl.java (avec proxy RMI)
 * 
 */
public class ServeurRMI {
    
    public static void main(String[] args) throws Exception {

	System.setProperty("java.rmi.server.hostname", _Config.RMI_host);

	Tier2.RMI_PartyManager.PartyManager manager = (Tier2.RMI_PartyManager.PartyManager) UnicastRemoteObject.exportObject(new PartyManagerImpl().new RMI(), 0);

	Registry registry = LocateRegistry.createRegistry(_Config.RMI_port);
	registry.bind(_Config.party_manager, manager);

	System.out.println("Service enregistre");
    }
}